import { getHomeList } from '@/api/home.js'
export default {
	namespaced: true,
	state: {
		homeList: [],
		tabObj: {
			label: '全部',
			value: 'all',
		},
		noticeList: [
			"寒雨连江夜入吴",
			"平明送客楚山孤",
			"洛阳亲友如相问",
			"一片冰心在玉壶",
		],
	},
	mutations: {
		change_homelist(state, value) {
			state.homeList = value;
		},
		push_homelist(state, value) {
			state.homeList = state.homeList.concat(value);
		},
		change_tabobj(state, value) {
			state.tabObj = value
		},
	},
	actions: {
		async homelist_action({ commit }, params) {
			let { data } = await getHomeList(params);
			commit('change_homelist', data);
		},
		async push_homelist_action({ commit }, params) {
			let { data } = await getHomeList(params);
			commit('push_homelist', data);
		},
		async change_tabobj_action({ commit }, data) {
			commit('change_tabobj', data);
		}
	}
}
